using System;
using System.Collections.Generic;
using System.Linq;

namespace DomainModel.Tests.Fakes
{
    public class FakeSignalementRepository : FakeRepositoryBase<Signalement>, ISignalementRepository
    {
        public bool IsPanneAlreadyReported(int objetPatrimonialId, int panneId)
        {
            return FakeDatabase.Values.Any(o => o.ObjetPatrimonial.Id == objetPatrimonialId && o.Panne.Id == panneId);
        }

        public List<Signalement> FindByVille(string town)
        {
            return FakeDatabase.Values.Where(o => String.Compare(o.ObjetPatrimonial.Town, town, StringComparison.OrdinalIgnoreCase) == 0).ToList();
        }
    }
}